<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class LinkageRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'category' => 'required',
            'name' => [
                'required',
            ],
            'sort' => 'integer|nullable',
        ];
        return $rules;
    }

    public function messages()
    {
        return [
            'category.required' => '请选择分类',
            'name.required' => '请填写名称',
            'value.required' => '请填写值',
            'sort.integer' => '排序序号只能为数字',
        ];
    }

}
